package com.tang.web;

import com.tang.server.NettyServer;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/nettyServer")
@RequiredArgsConstructor
public class NettyController {

    private final NettyServer nettyServer;

    @GetMapping("/localAddress")
    public String localAddress() {
        return "NettyServer LocalAddress: " + nettyServer.getChannel().localAddress();
    }

    @GetMapping("/isOpen")
    public String isOpen() {
        return "NettyServer isOpen: " + nettyServer.getChannel().isOpen();
    }

}
